package maa.action.admin.mentor;

import maa.action.Action;
import maa.action.ActionResult;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.UUID;

public class MentorCreationPage implements Action {
    @Override
    public ActionResult execute(HttpServletRequest req, HttpServletResponse resp) throws Exception {
        final HttpSession session = req.getSession();
        ActionResult actionResult = new ActionResult();
        String string = req.getParameter("uuid").substring(0, req.getParameter("uuid").length() - 1);
        final UUID uuid = UUID.fromString(string);
        session.setAttribute("id",uuid);
        actionResult.setResult("mentor-creation");
        actionResult.setRedirected(true);
        return actionResult;
    }
}
